// import { baseFun } from './require'
import { instance } from './require'

export async function getAsyncTodoList() {
  try {
    return await instance.get('/list')
  } catch (error) {
    console.error(error)
    return null
  }
}

export async function addAsyncTodo(data: unknown) {
  try {
    return await instance.post('/list', data)
  } catch (error) {
    return null
  }
}

export async function updateAsyncTodo(id: number, data: unknown) {
  try {
    return await instance.patch(`/list/${id}`, data)
  } catch (error) {
    return null
  }
}

export async function deleteAsyncTodo(id: number) {
  try {
    return await instance.delete(`/list/${id}`)
  } catch (error) {
    return null
  }
}
